﻿/**
 * @file guild_red_envelope_logic.h
 * @date 2021/06/08 19:52
 *
 * @author harrybao (harrybao@123u.com)
 *
 * @brief 公会红包模块逻辑
 *
 * @version v1.0.0
 *
 * @copyright Copyright © 2021 All Rights Reserved 上海欢乐互娱网络科技有限公司
 *
 * @par history:
 * <table>
 * <tr><th>Date                     <th>Version     <th>Author <th>Description
 * <tr><td>2021/06/08 19:52         <td>1.0.0       <td>harrybao
 * <td>创建初始版本
 * </table>
 */


#pragma once

#include <vector>
#include "error/error_code.h"
#include "guild/guild.h"

struct GuildRedEnvelopeBrief;
struct GuildModuleRedEnvelope;
struct GuildRedEnvelopeGrabber;

namespace guild_service {

/**
 * @brief 公会成员模块逻辑类
 *
 */
class GuildModuleRedEnvelopeLogic {
 public:
   using red_envelope_uid_type = uint64_t;  ///< 红包uid类型
 public:
   /**
    * @brief 获取公会红包模块
    *
    * @param guild_id 公会id
    * @param GuildRedEnvelope& module_red_envelope 公会红包模块
    * @return 获取结果
    */
   static bool GetModuleRedEnvelope(
       const guild_id_type guild_id,
       GuildModuleRedEnvelope &module_red_envelope);
 public:
  /**
   * @brief 发送公会红包
   * @param role_uuid 角色唯一id
   * @param red_envelope_brief 公会红包简略信息
   * @param passwd 口令密码
   * @param red_envelope_uuid 红包uuid
   * @return 发送结果
  */
  static bool SendGuildRedEnvelope(
      const role_uuid_type role_uuid,
      const GuildRedEnvelopeBrief &red_envelope_brief, const std::string &passwd,
      red_envelope_uid_type &red_envelope_uid,
      error_code &ec);

  /**
   * @brief 抢公会红包
   * @param role_uuid 角色唯一id
   * @param red_envelope_uuid 公会红包uuid
   * @param red_envelope_brief 公会红包简略信息
   * @param grabber_list 抢到红包的信息
   * @return 发送结果
  */
  static bool GrabGuildRedEnvelope(
      const role_uuid_type role_uuid,
      const red_envelope_uid_type red_envelope_uid,
      GuildRedEnvelopeBrief &red_envelope_brief,
      std::vector<GuildRedEnvelopeGrabber> &grabber_list, error_code &ec);

 private:
  // static bool IsGuildRedEnvelopeEmpty();
};

}  // namespace guild_service
